package com.wenguo.bussines.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wenguo.bussines.dao.UserDao;
import com.wenguo.bussines.model.User;
import com.wenguo.bussines.service.UserService;

@Service
public class UserServiceImpl implements UserService {
	
	@Autowired private UserDao userDao;

	@Override
	public boolean deleteUser(String id) {
		return userDao.delete(id);
	}
	
	@Override
	public Long findUserCount(User user) {
		return Long.parseLong(userDao.getCount(user).toString());
	}

	@Override
	public List<User> findUserByPage(Map<Object, Object> map) {
//		List<User> u = userDao.getByDefined(map);
//		System.out.println(u);
		return userDao.getByDefined(map);
	}

	@Override
	public List<User> findUserByDefined(Map<Object, Object> map) {
		return userDao.getByDefined(map);
	}

	@Override
	public List<User> findUserByEntity(User user) {
		return userDao.getByEntity(user);
	}

	@Override
	public User findUserById(String id) {
		return userDao.get(id);
	}

	@Override
	public List<User> findUserByMap(Map<Object, Object> map) {
		return userDao.getByMap(map);
	}

	@Override
	public boolean insertUser(User user) {
		return userDao.save(user);
	}
	
	@Override
	public boolean updateUserPwd(User user) {
		return userDao.updatePwd(user);
	}

	@Override
	public boolean updateUser(User user) {
		return userDao.update(user);
	}

}
